package org.kernely.mail;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;

/**
 * Activator of the mail bundle.
 */
public class Activator implements BundleActivator{

	/**
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext pBundleContext) throws Exception {
		
		// Declare mail templates
		ServiceReference sRef = pBundleContext.getServiceReference(HttpService.class.getName());
		if (sRef != null)
		{
			HttpService service = (HttpService) pBundleContext.getService(sRef);
			service.registerResources("/mailbundle/templates", "templates", null);
			service.registerResources("/mailbundle/images", "img", null);
		}
	}

	/**
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext arg0) throws Exception {
		
	}
    
}
